package com.xhw.web.config;

import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * @Author xhw
 * @Date 2023/8/24
 * @Version 1.0
 */

public class CustomJsonConverter extends MappingJackson2HttpMessageConverter {

    public CustomJsonConverter() {
        super();
        ObjectMapper objectMapper = getObjectMapper();
        // 设置不显示null值
        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    }
}
